package com.mall.common.util;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 响应工具类
 */
public class ResponseUtil {

    /**
     * 输出响应结果
     *
     * @param response HttpServletResponse
     * @param result   响应内容
     */
    public static void output(HttpServletResponse response, String result) throws IOException {
        response.setContentType("application/json;charset=UTF-8");
        PrintWriter writer = response.getWriter();
        writer.write(result);
        writer.flush();
        writer.close();
    }
}